package com.fumihiko.modules.wsbj.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.fumihiko.modules.wsbj.entity.UpProProcessEntity;
import com.fumihiko.modules.wsbj.service.UpProProcessService;
import com.fumihiko.common.utils.PageUtils;
import com.fumihiko.common.utils.R;



/**
 * 办件审批信息
 *
 * @author hanwenpeng
 * @email devilzwy@gmail.com
 * @date 2022-01-20 09:34:06
 */
@RestController
@RequestMapping("wsbj/upproprocess")
public class UpProProcessController {
    @Autowired
    private UpProProcessService upProProcessService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("wsbj:upproprocess:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = upProProcessService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{pkId}")
    @RequiresPermissions("wsbj:upproprocess:info")
    public R info(@PathVariable("pkId") String pkId){
		UpProProcessEntity upProProcess = upProProcessService.getById(pkId);

        return R.ok().put("upProProcess", upProProcess);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("wsbj:upproprocess:save")
    public R save(@RequestBody UpProProcessEntity upProProcess){
		upProProcessService.save(upProProcess);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("wsbj:upproprocess:update")
    public R update(@RequestBody UpProProcessEntity upProProcess){
		upProProcessService.updateById(upProProcess);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("wsbj:upproprocess:delete")
    public R delete(@RequestBody String[] pkIds){
		upProProcessService.removeByIds(Arrays.asList(pkIds));

        return R.ok();
    }

}
